package com.fuyu.web.kaogong.models.form;

import com.fuyu.model.entity.WxUser;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;


@Tag(name = "微信小程序用户登入")
@Data
public class WxLoginForm {
    @Schema(description = "微信小程序临时code")
    private String code;

    @Schema(description = "用户昵称")
    private String nickname;

    @Schema(description = "用户头像")
    private String avatarUrl;

    @Schema(description = "性别   性别  0 男  性别  1  女  性别  2 人妖")
    private Integer gender;

    @Schema(description = "所在国家")
    private String country;

    @Schema(description = "省份")
    private String province;

    @Schema(description = "城市")
    private String city;

    @Schema(description = "语言")
    private String language;

    @Schema(description = "手机类型")
    private String mobile;

    @Schema(description = "手机号码")
    private String phone;


    public static WxUser toEntity(WxLoginForm wxLoginForm) {
        WxUser wxUser = new WxUser();
        wxUser.setNickname(wxLoginForm.getNickname());
        wxUser.setAvatarUrl(wxLoginForm.getAvatarUrl());
        wxUser.setGender(wxLoginForm.getGender());
        wxUser.setCountry(wxLoginForm.getCountry());
        wxUser.setProvince(wxLoginForm.getProvince());
        wxUser.setCity(wxLoginForm.getCity());
        wxUser.setLanguage(wxLoginForm.getLanguage());
        wxUser.setMobile(wxLoginForm.getMobile());
        wxUser.setPhone(wxLoginForm.getPhone());
        return wxUser;
    }
}
